import 'virtual:svg-icons-register' // Register icon sprite
import { createApp } from 'vue'
import App from './App.vue'
import { setupGlobalCom } from './components/index'
import { setupElementPlus } from './libs/element' // element UI
import router, { setupRouter } from './router' // 路由
import { setupStore } from './store' // 状态管理
import { setupDirectives } from './directives' // 状态管理
import { $error, $success, $warning } from '@/utils/message'
import { $msgBox } from '@/utils/messageBox'
import { bus } from '@/utils/bus'

import * as echarts from 'echarts'
import vue3SeamlessScroll from 'vue3-seamless-scroll'
import mitt from 'mitt'
// const vueEvent = mitt()

import '@/styles/fonts/iconfont.css'
import '@/styles/fonts/file/iconfont.css'
import './styles/index.scss'

const app = createApp(App)

setupRouter(app) // 引入路由

setupStore(app) // 引入状态管理

setupDirectives(app) // 自定义指令

setupElementPlus(app) // 引入element组件

setupGlobalCom(app) // 注册全局公用组件

app.config.globalProperties.$bus = bus // 公共eventbus

app.config.globalProperties.$echarts = echarts // echarts引入
app.config.globalProperties.$error = $error
app.config.globalProperties.$success = $success
app.config.globalProperties.$warning = $warning
app.config.globalProperties.$msgBox = $msgBox
// app.config.globalProperties.$vueEvent = vueEvent

router.isReady().then(() => {
  app.use(vue3SeamlessScroll)
  app.mount('#app')
})
